'use strict';

angular.module('fbdApp.templateModule')

.controller('tplGroupCtrl', function($scope) {
  console.log($scope.removeTpls);
  $scope.testing = true;
  // console.log($scope.removeTpls);
  $scope.goDel = function(index) {
    console.log(index);
    $scope.removeTpls.splice(index, 1);
  };

  $scope.goUp = function(index) {
    // console.log($scope.removeTpls);
    // 最上面的不能再改变index
    if (index != 0) {
      var temp = $scope.removeTpls[index];
      $scope.removeTpls[index] = $scope.removeTpls[index - 1];
      $scope.removeTpls[index - 1] = temp;

    }
  };

  $scope.goDown = function(index) {
    // 最下面的不能再改变index

    var len = $scope.removeTpls.length;
    if (index != len - 1) {
      var temp = $scope.removeTpls[index];
      $scope.removeTpls[index] = $scope.removeTpls[index + 1];
      $scope.removeTpls[index + 1] = temp;
    }
  };


});
